package com.autoreassociate.receiver;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;

import com.autoreassociate.tool.ConnectionAssociateTool;

public class ConnectionCheckReceiver extends BroadcastReceiver {
	
	public final static String REQUEST_CHECK_REASSOCIATE = "com.wifireconn.receiver.REQUEST_CHECK_REASSOCIATE";
	
	public final static int FLAGS_REQUEST_RESET = 1;
	
	public final static Intent REASSOCIATE_INTENT = new Intent(ConnectionCheckReceiver.REQUEST_CHECK_REASSOCIATE);
	//public final static Intent REQUEST_RESET_INTENT = new Intent(ConnectionCheckReceiver.REQUEST_CHECK_REASSOCIATE).setFlags(FLAGS_REQUEST_RESET);
	
	//private SimpleDateFormat dataFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");

	protected ConnectionAssociateTool connectionAssociateTool;
	
	/**
	 * @see android.content.BroadcastReceiver#onReceive(Context,Intent)
	 */
	@Override
	public void onReceive(Context context, Intent intent) {

		connectionAssociateTool = ConnectionAssociateTool.getInstance();
		
		if (connectionAssociateTool == null) {
			//connectionAssociateTool = ConnectionAssociateTool.getInstance(context);
			return;
		}

		
//		if (intent. == FLAGS_REQUEST_RESET) {
//			connectionAssociateTool.attributesReset();
//			connectionAssociateTool.endWifiStatusReciver();
//			connectionAssociateTool.startWifiStatusReceiver();
//
//			return;
//		}

		
		connectionAssociateTool.sendPingOrReconnect();
		
		
		
		
		//if (REQUEST_CHECK_REASSOCIATE.equals(intent.getAction())) {
			//connectionAssociateTool.sendPing();
		//}

	}

	

}
